<?include_once('template.php');?>

<html>
	<?
		$draft = getDraft($_SESSION['team']->draftID);
		$teamOnClock = getPickingTeam($draft);
		echo getHeader();
	?>

<body>
	<?echo getToolbar($draft, $ie, 2);?>
	<div class="container-fluid">
		<?echo getNavBar($draft);?>
		<div class="content">
			<?echo getClockMessage($teamOnClock);?>

			
			<?
$allTeams = getAllTeamsInDraft($draft->id);
$teamID = $_GET['id'] ?  $_GET['id'] : $_SESSION['team']->id;
$currentTeam = $_SESSION['team'];
$dropdown = "<select class='team-select' name='team-select'>";
$dropdown = $dropdown."<option value=''>Select A Team...</option>";
foreach($allTeams as $t)
{
	$dropdown = $dropdown."<option value='".$t->id."'>".$t->name."</option>";
	if ($t->id == $teamID)
	{
		$currentTeam = $t;
	}
}
$dropdown = $dropdown."</select>";

echo "<div class='team-header'>";
	echo "<span class='teamName'>".$currentTeam->name." - Draft Order: ".$currentTeam->draftOrder."</span>";
	echo "<span class='team-selector'>".$dropdown."</span>";
echo "</div>";

echo getSimplePlayerTable($teamID);

?>
		</div>
	</div>
<script type='text/javascript' src='teamswitch.js'></script>
</body>
</html>


<?

function getSimplePlayerTable($teamID)
{
	$players = getPlayersForTeam($teamID);
	$table = "<table class='player";
		$table = $ie ? $table." ie'>" : $table."'>";
		$table = $table."<thead>"; 
		$table = $table."<tr>";
			$table = $table."<th scope='col' class='col1'>PICK</th>";
			$table = $table."<th scope='col' class='col2'>&nbsp</th>";
			$table = $table."<th scope='col' class='col3'>NAME</th>";
			$table = $table."<th scope='col' class='col4'>POS</th>";
			$table = $table."<th scope='col' class='col5'>BYE</th>";
		$table = $table."</tr>";  
	$table = $table."</thead>";
	$table = $table."<tbody>";
	foreach ($players as $p)
	{
		$table = $table.$p->getDisplayFormat(true);
	}
	return $table;
}

?>